<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%--
代码为自动生成 Created by www.magicalcoder.com
 如果你改变了此类 read 请将此行删除
 欢迎加入官方QQ群:323237052
--%>
<html>
<head>
    <%@include file="../../common/head.jsp"%>
    <title>后台操作日志编辑</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <%@include file="../include/head.jsp"%>
</head>
<body class="skin-blue">
    <header class="header">
        <%@include file="../include/top.jsp"%>
    </header>
    <div class="wrapper row-offcanvas row-offcanvas-left" id="formArea">
        <aside class="left-side sidebar-offcanvas">
            <%@include file="../include/left.jsp"%>
        </aside>
        <aside class="right-side">
            <section class="content-header">
                <h1>
                    后台操作日志详情
                    <small></small>
                </h1>
                <ol class="breadcrumb">
                    <li><a href="admin/index"><i class="fa fa-dashboard"></i> 主页</a></li>
                    <li><a href="admin/log_admin_operate/list">后台操作日志列表</a></li>
                    <li class="active">后台操作日志详情</li>
                </ol>
            </section>
            <section class="content">
                <div class="row">
                    <div class="col-md-12">
                        <div class="box box-primary">
                            <form class="form-horizontal" role="form" id="form" action="admin/log_admin_operate/save" method="post">
                                <div class="box-header">
                                    <h3 class="box-title">
                                        <c:choose><c:when test="${logAdminOperate.id==null}">新增</c:when><c:otherwise>编辑</c:otherwise></c:choose>
                                    </h3>
                                    <h3 class="box-title alert-danger">${exceptionMsg}</h3>
                                </div>
                                    <input type="hidden" name="id" value="${logAdminOperate.id}">
                                <input type="hidden" id="queryParamCacheKey" name="queryParamCacheKey" value="${queryParamCacheKey}">

                                <div class="box-body">

                                    <%--adminUserId 管理员 --%>
                                    <div class="form-group ">
                                        <label class="col-sm-1 control-label">管理员</label>
                                         <div class="col-sm-9">
                                            <select class="form-control single-select2-ajax"  name="adminUserId" foreignTableName="admin_user" foreignJavaField="id" selectValue="" values="${logAdminOperate.adminUserId}" openUrl="admin/admin_user/detail_param?id="></select>
                                        </div>
                                        <label class="col-sm-2 control-label" ><span class="validateMsg"></span></label>
                                    </div>

                                    <%--userName 管理员名称 --%>
                                    <div class="form-group ">
                                        <label class="col-sm-1 control-label">管理员名称</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control "  name="userName" title="管理员名称"   value="${logAdminOperate.userName}" style="min-width: 100px;"  placeholder="请输入管理员名称">
                                        </div>
                                        <label class="col-sm-2 control-label" ><span class="validateMsg"></span></label>
                                    </div>

                                    <%--tableName 表名 --%>
                                    <div class="form-group ">
                                        <label class="col-sm-1 control-label">表名</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control "  name="tableName" title="表名"   value="${logAdminOperate.tableName}" style="min-width: 100px;"  placeholder="请输入表名">
                                        </div>
                                        <label class="col-sm-2 control-label" ><span class="validateMsg"></span></label>
                                    </div>

                                    <%--url 链接 --%>
                                    <div class="form-group ">
                                        <label class="col-sm-1 control-label">链接</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control "  name="url" title="链接"   value="${logAdminOperate.url}" style="min-width: 100px;"  placeholder="请输入链接">
                                        </div>
                                        <label class="col-sm-2 control-label" ><span class="validateMsg"></span></label>
                                    </div>

                                    <%--operateType 操作类型 --%>
                                    <div class="form-group ">
                                        <label class="col-sm-1 control-label">操作类型</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control "  name="operateType" title="操作类型"   value="${logAdminOperate.operateType}" style="min-width: 100px;"  placeholder="请输入操作类型">
                                        </div>
                                        <label class="col-sm-2 control-label" ><span class="validateMsg"></span></label>
                                    </div>

                                    <%--formBody 提交内容 --%>
                                    <div class="form-group ">
                                        <label class="col-sm-1 control-label">提交内容</label>
                                        <div class="col-sm-9">
                                            <textarea name="formBody" title="提交内容" style="min-width: 100px;" cols="100" rows="8" class="form-control "  placeholder="请输入提交内容" >${logAdminOperate.formBody}</textarea>
                                        </div>
                                        <label class="col-sm-2 control-label" ><span class="validateMsg"></span></label>
                                    </div>

                                    <%--createTime 创建时间 --%>
                                    <div class="form-group ">
                                        <label class="col-sm-1 control-label">创建时间</label>
                                        <div class="col-sm-9">
                                            <input type="text" name="createTime" class="Wdate form-control"  onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="<fmt:formatDate value="${ logAdminOperate.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/>" style="min-width: 170px;">
                                        </div>
                                        <label class="col-sm-2 control-label" ><span class="validateMsg"></span></label>
                                    </div>

                                    <%--primaryIdValue 主键值 --%>
                                    <div class="form-group ">
                                        <label class="col-sm-1 control-label">主键值</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control "  name="primaryIdValue" title="主键值"   value="${logAdminOperate.primaryIdValue}" style="min-width: 100px;"  placeholder="请输入主键值">
                                        </div>
                                        <label class="col-sm-2 control-label" ><span class="validateMsg"></span></label>
                                    </div>
                                    <div class="form-group <c:if test="${ logAdminOperateId==null }">hidden</c:if> " id="historyOperateRecords">
                                        <label class="col-sm-1 control-label">
                                            历史记录
                                        </label>
                                        <div class="col-sm-9" style="min-width:120px">
                                            <select class="form-control" onchange="historySelectChange(this)">
                                                <option value="">请选择</option>
                                                <c:forEach var="log" items="${logAdminOperateList}">
                                                    <option <c:if test="${ log.id==logAdminOperateId }">selected</c:if> value="${log.id}"><fmt:formatDate value="${ log.createTime }" pattern="yyyy-MM-dd HH:mm:ss" />-${ log.userName }</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </div>
                                </div><!-- /.box-body -->
                                <div class="box-footer">
                                        <c:if test="${ adminPriority!=null and ((adminPriority.canInsert and logAdminOperate.id==null) or (adminPriority.canUpdate and logAdminOperate.id!=null))}">
                                            <button type="button" onclick="submitForm2('#formArea','#form',realSubmit)" class="btn btn-danger">保存</button>
                                        </c:if>
                                        <button type="button" onclick="returnToListPage('log_admin_operate','${queryParamCacheKey}','${logAdminOperate.id}')"  class="btn btn-primary">返回</button>
                                    <button type="button" onclick="historySelectShow()"  class="btn btn-primary">显示历史记录</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </section>

            <section class="content">
                <div class="row">
                    <div class="col-md-12">
                        <div class="nav-tabs-custom">
                            <ul class="nav nav-tabs">
                            </ul>
                            <div class="tab-content">
                            </div>
                        </div>
                    </div>
                </div>
            </section>

        </aside>
    </div>

    <div class="hidden">
    </div>
    <%@include file="../include/tail.jsp"%>

    <script type="text/javascript" >
        $(function(){
            //base.js
            validateForm2($("#formArea"))
            //inputSelect
            initSingleSelect2Ajax($("section"))
            autoSetSingleSelect2Value($("section"))
        })
        function realSubmit(){
            var form = $("#form")
            var logAdminOperate = findFormData(form)
                logAdminOperate.date = new Date().getTime()
                $.post("admin/log_admin_operate/ajax_save",logAdminOperate,function(data){
                    if(data.code != 0){
                        alert(data.message)
                    }else {
                        var relateId = data.info
                    }
            })
        }
    </script>
</body>
</html>
